#ifndef _COMPAT_DEF_H_
#define _COMPAT_DEF_H_


#if 1
#define LIKELY(x)	__builtin_expect(!!(x), 1)
#define UNLIKELY(x)	__builtin_expect(!!(x), 0)
#else
#define	LIKELY
#define	UNLIKELY
#endif

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif



#define container_of(ptr, type, member) ({			\
	const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
	(type *)( (char *)__mptr - offsetof(type,member) );})



#if (TARGET_OS == OS_POSIX)
# define SYS_POSIX
# define HAS_EPOLL
	#define STD_METHOD(type) type
#elif (TARGET_OS == OS_MAC)
# define SYS_UNIX
# define HAS_KQUEUE
	#define STD_METHOD(type) type
#elif  (TARGET_OS == OS_WINDOWS)
# define SYS_WIN
# define HAS_IOCP

	#define FUNC_EXPORTS 1
	#define STD_METHOD(type) type

#else
# error "unknown OS"
#endif


#endif 
